#include<iostream>
#include<vector>
using namespace std;


int main()
{

	int n;
	cin >> n;
	vector<int>nums(n);
	for (int i = 0; i < n; i++)
		cin >> nums[i];

	long long sum = 0;
	long long ret = 0;
	for (int i = 0; i < n; i++)
		sum += nums[i];

	for (int i = 0; i < n - 1; i++)
	{
		sum -= nums[i];
		ret += nums[i] * sum;

	}

	cout << ret;
	return 0;
}